
function formatTotalPrice(price: number, num: number) {
  let totalPrice = price * num;
  let totalPriceStr = totalPrice.toString();
    let len = totalPriceStr.length;
    if (len == 0) {
      totalPriceStr = "0.00";
    } else if (len == 1) {
      totalPriceStr = "0.0" + totalPriceStr;
    } else if (len == 2) {
      totalPriceStr = "0." + totalPriceStr;
    } else {
      totalPriceStr = totalPriceStr.substring(0, len - 2) + "." + totalPriceStr.substring(len - 2, len);
    }
    return totalPriceStr;
}

export {formatTotalPrice}